package homework.oo1;

public class StringTalk {
    public static void main(String[] args) {

        for (int i=100;i<1000;i++){
            if (isNarcissistic(i)){
                System.out.println(i+"是一个水仙花数");
            }
        }
    }

    public static boolean isNarcissistic(int num){
        int hundreds = num/100;
        int tens = (num/10)%10;
        int ones = num%10;

        int sum = (hundreds*hundreds*hundreds+tens*tens*tens+ones*ones*ones);
        return sum == num;

    }
}
